/**
 * @description: 按钮权限指令
 * @example: <div v-authority>新增</div>
 */
import useAppStore from '@/store/app'
import { router } from '@/routes'

export default {
  beforeMount(el, bing) {
    const appStore = useAppStore()
    const buttonAuthority = appStore.BUTTON_AUTHORITY[router.currentRoute.value.path] || []
    // if (!buttonAuthority) return
    const buttonText = bing.value || el.innerText.replace(' ', '')
    if (!buttonAuthority.includes(buttonText)) {
      el.style.display = 'none'
    }
  }
}
